import 'package:flutter_deer/generated/json/base/json_convert_content.dart';
import 'package:flutter_deer/database/beans/pay_type_model.dart';
import 'package:flutter_deer/database/database_manager.dart';

import 'package:objectbox/objectbox.dart';

import 'package:flutter_deer/dl/dl.dart';

import 'package:flutter_deer/res/emuns/pay_type_enum.dart';


PayTypeModel $PayTypeModelFromJson(Map<String, dynamic> json) {
  final PayTypeModel payTypeModel = PayTypeModel();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    payTypeModel.id = id;
  }
  final bool? switchConsumePay = jsonConvert.convert<bool>(json['switchConsumePay']);
  if (switchConsumePay != null) {
    payTypeModel.switchConsumePay = switchConsumePay;
  }
  final bool? switchPrint = jsonConvert.convert<bool>(json['switchPrint']);
  if (switchPrint != null) {
    payTypeModel.switchPrint = switchPrint;
  }
  final int? mSortNo = jsonConvert.convert<int>(json['mSortNo']);
  if (mSortNo != null) {
    payTypeModel.mSortNo = mSortNo;
  }
  final int? sortNo = jsonConvert.convert<int>(json['sortNo']);
  if (sortNo != null) {
    payTypeModel.sortNo = sortNo;
  }
  final String? paymentName = jsonConvert.convert<String>(json['paymentName']);
  if (paymentName != null) {
    payTypeModel.paymentName = paymentName;
  }
  final String? paymentScene = jsonConvert.convert<String>(json['paymentScene']);
  if (paymentScene != null) {
    payTypeModel.paymentScene = paymentScene;
  }
  final String? paymentCode = jsonConvert.convert<String>(json['paymentCode']);
  if (paymentCode != null) {
    payTypeModel.paymentCode = paymentCode;
  }
  final String? paymentModeId = jsonConvert.convert<String>(json['paymentModeId']);
  if (paymentModeId != null) {
    payTypeModel.paymentModeId = paymentModeId;
  }
  final int? paymentType = jsonConvert.convert<int>(json['paymentType']);
  if (paymentType != null) {
    payTypeModel.paymentType = paymentType;
  }
  final String? merchantPaymentModeId = jsonConvert.convert<String>(json['merchantPaymentModeId']);
  if (merchantPaymentModeId != null) {
    payTypeModel.merchantPaymentModeId = merchantPaymentModeId;
  }
  final String? payMethod = jsonConvert.convert<String>(json['payMethod']);
  if (payMethod != null) {
    payTypeModel.payMethod = payMethod;
  }
  final bool? choose = jsonConvert.convert<bool>(json['choose']);
  if (choose != null) {
    payTypeModel.choose = choose;
  }
  return payTypeModel;
}

Map<String, dynamic> $PayTypeModelToJson(PayTypeModel entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['switchConsumePay'] = entity.switchConsumePay;
  data['switchPrint'] = entity.switchPrint;
  data['mSortNo'] = entity.mSortNo;
  data['sortNo'] = entity.sortNo;
  data['paymentName'] = entity.paymentName;
  data['paymentScene'] = entity.paymentScene;
  data['paymentCode'] = entity.paymentCode;
  data['paymentModeId'] = entity.paymentModeId;
  data['paymentType'] = entity.paymentType;
  data['merchantPaymentModeId'] = entity.merchantPaymentModeId;
  data['payMethod'] = entity.payMethod;
  data['choose'] = entity.choose;
  return data;
}

extension PayTypeModelExtension on PayTypeModel {
  PayTypeModel copyWith({
    int? id,
    bool? switchConsumePay,
    bool? switchPrint,
    int? mSortNo,
    int? sortNo,
    String? paymentName,
    String? paymentScene,
    String? paymentCode,
    String? paymentModeId,
    int? paymentType,
    String? merchantPaymentModeId,
    String? payMethod,
    bool? choose,
  }) {
    return PayTypeModel()
      ..id = id ?? this.id
      ..switchConsumePay = switchConsumePay ?? this.switchConsumePay
      ..switchPrint = switchPrint ?? this.switchPrint
      ..mSortNo = mSortNo ?? this.mSortNo
      ..sortNo = sortNo ?? this.sortNo
      ..paymentName = paymentName ?? this.paymentName
      ..paymentScene = paymentScene ?? this.paymentScene
      ..paymentCode = paymentCode ?? this.paymentCode
      ..paymentModeId = paymentModeId ?? this.paymentModeId
      ..paymentType = paymentType ?? this.paymentType
      ..merchantPaymentModeId = merchantPaymentModeId ?? this.merchantPaymentModeId
      ..payMethod = payMethod ?? this.payMethod
      ..choose = choose ?? this.choose;
  }
}